namespace Yto.EFTests.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class init : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.PRODUCTS",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false),
                        ISDELETE = c.Boolean(nullable: false),
                        DELETETIME = c.DateTime(),
                        DELETERID = c.Long(),
                        MODIFYTIME = c.DateTime(),
                        MODIFIERID = c.Long(),
                        CREATORID = c.Long(),
                        CREATETIME = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.USERSINFO",
                c => new
                    {
                        ID = c.Long(nullable: false, identity: true),
                        PASSWORD = c.String(nullable: false, maxLength: 32),
                        NAME = c.String(nullable: false),
                        ISACTIVE = c.Boolean(nullable: false),
                        USERNAME = c.String(nullable: false, maxLength: 32),
                        EMAILADDRESS = c.String(nullable: false, maxLength: 256),
                        LASTLOGINTIME = c.DateTime(),
                        ISDELETE = c.Boolean(nullable: false),
                        DELETETIME = c.DateTime(),
                        DELETERID = c.Long(),
                        MODIFYTIME = c.DateTime(),
                        MODIFIERID = c.Long(),
                        CREATORID = c.Long(),
                        CREATETIME = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.ID)
                .ForeignKey("dbo.USERSINFO", t => t.CREATORID)
                .ForeignKey("dbo.USERSINFO", t => t.DELETERID)
                .ForeignKey("dbo.USERSINFO", t => t.MODIFIERID)
                .Index(t => t.DELETERID)
                .Index(t => t.MODIFIERID)
                .Index(t => t.CREATORID);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.USERSINFO", "MODIFIERID", "dbo.USERSINFO");
            DropForeignKey("dbo.USERSINFO", "DELETERID", "dbo.USERSINFO");
            DropForeignKey("dbo.USERSINFO", "CREATORID", "dbo.USERSINFO");
            DropIndex("dbo.USERSINFO", new[] { "CREATORID" });
            DropIndex("dbo.USERSINFO", new[] { "MODIFIERID" });
            DropIndex("dbo.USERSINFO", new[] { "DELETERID" });
            DropTable("dbo.USERSINFO");
            DropTable("dbo.PRODUCTS");
        }
    }
}
